/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bl;

import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author Kien Chinh
 */
public class StatusColumnCell implements TableCellRenderer {

    @Override
    public Component getTableCellRendererComponent(JTable table, Object label, boolean isSelected, boolean hasFocus, int row, int col) {
        JLabel l = (JLabel) label;
        if (col == 7) {
            l.setFont(new Font("Candara", Font.BOLD, 14));
            l.setForeground(Color.BLUE);
            l.setCursor(new Cursor(Cursor.HAND_CURSOR));
        } else if (col == 4) {
            l.setFont(new Font("Candara", Font.BOLD, 14));
            if (l.getText().equalsIgnoreCase("Approved")) {
                l.setForeground(Color.GREEN);
            } else if (l.getText().equalsIgnoreCase("Pending")) {
                l.setForeground(Color.BLACK);
            } else {
                l.setForeground(Color.RED);
            }
            l.setText("        " + l.getText());
        }else if (col == 5){
            l.setFont(new Font("Candara", Font.BOLD, 14));
            l.setForeground(Color.BLUE);
            l.setCursor(new Cursor(Cursor.HAND_CURSOR));
        }
        return l;
    }
}
